package com.guigu.community.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.community.mapper.OrderMapper;
import com.guigu.community.pojo.Orders;
import com.guigu.community.service.OrderService;
import com.guigu.community.vo.OrderVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Orders> implements OrderService {
    @Autowired
    private OrderMapper orderMapper;
    @Override
    public String queryMaxId() {
        Orders order = orderMapper.selectByOrderIdOrder();
        if (order != null){
            return order.getOrderId();
        }
        return  null;
    }

    @Override
    public PageInfo<Orders> queryOrderItems(Integer pageNo, Integer pageSize, OrderVo orderVo) {
        PageHelper.startPage(pageNo,pageSize);
        List<Orders> orders = orderMapper.selectOrderItem(orderVo);
        PageInfo<Orders> PageInfo = new PageInfo<>(orders);
        return PageInfo;
    }
}
